package com.xbh.boot_study.init;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @MyInit: 我的初始化内容
 * @author: ZBoHang
 * @time: 2021/9/30 8:38
 */
@Slf4j
@Order(1)
@Component
public class MyInit implements ApplicationRunner {

    /**
     * 1.@PostConstruct 和 @PreDestroy
     * 2.implements ApplicationRunner
     * 3.implements CommendLineRunner
     */

    @Override
    public void run(ApplicationArguments args) throws Exception {
        log.info("@@@@@@@@@@ -->> 我的自定义初始化完成");
    }

    @PreDestroy
    public void end() {
        log.info("@@@@@@@@@@  -->>  程序关闭中");
    }
}
